<?php

namespace Assets\UploadBundle\Controller;

use BaseExt\PicUpload;
use Monolog\Handler\StreamHandler;
use Symfony\Bridge\Monolog\Logger;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Component\HttpFoundation\JsonResponse;

class UploadifyController extends Controller
{

    /**
     * @Route("/UploadWebPic" , name="UploadifyWebPic")
     */
    public function WebPicAction()
    {
        $picUploadModel = new PicUpload();
        $rst = $picUploadModel->doUpload("Filedata");
        $data = $picUploadModel->getData();
        if ($data) {
            $re = array(
                "s"=>1,
                "i"=>"上传成功",
                "d"=>$data["Filedata"],
            );
        } else {
            $re = $rst;
        }
        return new JsonResponse($re);
    }
}
